package org.poliglot.ipa;

/**
 * User: cristi
 * Date: 01.05.2010
 * Time: 22:15:43
 */
public class RomanianPhoneticTranslator extends PhoneticTranslator
{

    protected void processCharacter( char c, StringBuilder sb )
    {
        switch ( c )
        {
            case 226: // ih
            case 238: // ih
                sb.append( '\u0268' );
                break;

            case 259: // ah
                sb.append( '\u0259' );
                break;

            case 351: // sh
                sb.append( '\u0283' );
                break;

            case 355: // tz
                sb.append( "ts" );
                break;

            case 'c':
                if ( 'h' == next() && isBefore( pos + 1, 'e', 'i' ) )
                {
                    sb.append( "k" );
                    pos++;
                }
                else
                {
                    sb.append( isBefore( pos, 'e', 'i' ) ? '\u02A7' : 'k' );
                }
                break;

            case 'g':
                if ( 'h' == next() && isBefore( pos + 1, 'e', 'i' ) )
                {
                    sb.append( "g" );
                    pos++;
                }
                else
                {
                    sb.append( isBefore( pos, 'e', 'i' ) ? '\u02A4' : 'g' );
                }
                break;

            case 'j':
                sb.append( '\u0292' );
                break;

            case 'q':
                sb.append( 'k' );
                break;

            case 'x':
                sb.append( "cs" );
                break;

            default:
                sb.append( c );
        }
    }
}